package com.controller.system;

import com.common.ResultUtil;
import com.common.stereotype.Module;
import com.common.stereotype.Uri;
import com.controller.base.BaseLocalController;
import com.facade.log.IOperationLogFacadeCUD;
import com.facade.log.IOperationLogFacadeR;
import com.query.OperationLogQueryLink;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/operationLog")
@Module(parent = "系统模块", name = "日志管理", parentModuleOrder = 0, childModuleOrder = 9)
public class OperationLogController extends BaseLocalController {

    @Resource
    private IOperationLogFacadeR operationLogFacadeR;
    @Resource
    private IOperationLogFacadeCUD operationLogFacadeCUD;

    @RequestMapping(value = "/query.htm")
    @Uri(name = "查询", uri = "/operationLog/query", order = 0)
    public String query(@ModelAttribute("query") OperationLogQueryLink query, ModelMap modelMap) {
        modelMap.addAttribute("paging", operationLogFacadeR.queryOperationLogPageLink(query));
        return "system/operation-log-List";
    }

    @ResponseBody
    @RequestMapping(value = "/delete.htm")
    @Uri(name = "删除", uri = "/operationLog/delete", order = 1)
    public ResultUtil delete(Long[] id) {
        return operationLogFacadeCUD.deleteOperationLog(id);
    }
}